<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %>
<!DOCTYPE HTML>
<html ng-app>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <title>${title}</title>
    <%@ include file="/WEB-INF/jsp/commons/meta.jsp" %>
    <link href="${ctx}/resources/new/style.css" type="text/css" rel="stylesheet"/>

</head>
<body>
<script>
    $(document).ready(function () {
        //聚焦第一个输入框
        $("#mobile").focus();
        //为inputForm注册validate函数
        $("#inputForm").validate({
            rules: {
                mobile: {
                    required: true,
                    remote: {
                        type: "POST",
                        url: "${ctx}/point/member/repeat",
                        data: {
                            mobile: function () {
                                return $("#mobile").val();
                            }
                        }
                    }
                },
                userName: "required",
                password: {
                    required: true,
                    minlength: 6,
                    maxlength:12
                }
            },
            messages: {
                mobile: {
                    remote: $.format("该账号已经存在，请重新输入！")
                }
            }
        });
    });
</script>
<form id="inputForm" class="well form-inline" action="${ctx}/point/member/save" method="post">
    <table class="table table-striped table-bordered table-condensed">
        <thead>
        <strong>
            <i class="icon-flag"></i>
            积分会员表单
        </strong>
        </thead>
        <tr>
            <td class="span2">
                <span class="tRed">*</span>
                账号(手机号):
            </td>
            <td>
                <input name="mobile" id="mobile" type="text">
            </td>
        </tr>
        <tr>
            <td>
                <span class="tRed">*</span>
                密码:
            </td>
            <td>
                <input name="password" type="text">
            </td>
        </tr>
        <tr>
            <td>
                <span class="tRed">*</span>
                姓名:
            </td>
            <td>
                <input name="userName" type="text">
            </td>
        </tr>
        <tr>
            <td>微信号:</td>
            <td>
                <input name="weixin" type="text">
            </td>
        </tr>
        <tr>
            <td>性别:</td>
            <td>
                <label class="radio">
                    <input value="男" name="gender" checked="checked" type="radio">
                    男
                </label>
                <label class="radio">
                    <input value="女" name="gender" type="radio">
                    女
                </label>
            </td>
        </tr>
        <tr>
            <td>宝宝生日:</td>
            <td>
                <input id="babyBirth" name="babyBirth" type="text" datepicker>
            </td>
        </tr>
        <tr>
            <td>备注:</td>
            <td>
                <textarea id="memo" name="memo" rows="4" class="span6">${users.memo}</textarea>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input class="btn" type="submit" value="提交"/>
                &nbsp;
                <input class="btn" type="button" value="返回" back="back" onclick="history.go(-1)"/>
            </td>
        </tr>
    </table>
</form>

<script>
    $(function () {
        $("#inputForm").submit(function () {
            var babyBirth = $.trim($("#babyBirth").val());
            if (!babyBirth) {
                $("#babyBirth").remove();
            }
        });
    });
</script>
</body>
</html>